<template>
	<view class="page" v-if="meterInfo">
		<view class="xb-info">
			<view>
				<text>位置</text>
				<text>{{meterInfo.parkNum}}{{meterInfo.buildingNum}}</text>
			</view>
			<view>
				<text>类型</text>
				<text>{{meterInfo.meterType||'-'}}</text>
			</view>
			<view>
				<text>设备编号</text>
				<text>{{meterInfo.meterNum}}</text>
			</view>
			<view>
				<text>设备状态</text>
				<text :style="{color:meterInfo.state===0?'red':'#44D94B'} ">{{meterInfo.state===0?'停用':'启用'}}</text>
			</view>
		</view>

		<view class="xb-info">
			<view>
				<text>企业</text>
				<text>{{meterInfo.enterpriseName||'-'}}</text>
			</view>
			<view>
				<text>用途</text>
				<text>{{meterInfo.category||'-'}}</text>
			</view>
			<view>
				<text>上级表</text>
				<text>{{ meterInfo.parentNum }}</text>
			</view>
			<view>
				<text>日期</text>
				<text>{{meterInfo.currentCheckDate||'-'}}</text>
			</view>
			<view>
				<text>起数</text>
				<text>{{meterInfo.lastValue||'-'}}</text>
			</view>
			<view>
				<text>止数</text>
				<text>{{meterInfo.currentValue}}</text>
			</view>
			<view>
				<text>差值</text>
				<text v-if="meterInfo.currentValue&&meterInfo.lastValue">{{meterInfo.currentValue-meterInfo.lastValue}}</text>
        <text v-else>-</text>
			</view>
		</view>

		<view class="bd-info" @click="navTo('/pagesEnergy/hydroelectric/hydHistory?meterId='+meterId)">
			<view class="col">
				<text>历史读数</text>
				<u-icon name="arrow-right" size="20" style="padding: 0;margin: 0;" color="#999999"></u-icon>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				meterInfo: null,
				meterId: ''
			}
		},
		onLoad(e) {
			if (typeof e.meterId !="undefined") {
				this.meterId = e.meterId
				this.getMeterInfo()
			} else {
				console.log("this.$store.state.energy.checkMeter", this.$store.state.energy.checkMeter)
				this.meterInfo = this.$store.state.energy.checkMeter
			}
			// this.apis.energyApi.nyCheckMeterById('1443109088153042944').then(res => {

			// })
		},
		methods: {
			getMeterInfo() {
				this.apis.energyApi.getMeterInfo(this.meterId).then(res => {
					this.meterInfo = res.data
				})
			}
		}
	}
</script>

<style>
</style>
